package com.ruoyi.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.domain.TCertificateDocument;
import com.ruoyi.domain.THighwayConstructionSupervisionAuxiliary;
import com.ruoyi.domain.THighwayConstructionSupervisionAuxiliaryAttach;
import com.ruoyi.utils.AliOSSUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.domain.THighwayConstructionSupervisionAuxiliary;
import com.ruoyi.service.ITHighwayConstructionSupervisionAuxiliaryService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;

/**
 * 公路建设监督系统辅助信息Controller
 * 
 * @author ruoyi
 * @date 2024-11-06
 */
@RestController
@RequestMapping("/talent/road")
@Slf4j
public class THighwayConstructionSupervisionAuxiliaryController extends BaseController
{
    @Autowired
    private ITHighwayConstructionSupervisionAuxiliaryService tHighwayConstructionSupervisionAuxiliaryService;
    @Autowired
    private AliOSSUtils aliOSSUtils;
    /**
     * 查询公路建设监督系统辅助信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:auxiliary:list')")
    @GetMapping("/list")
    public TableDataInfo list(THighwayConstructionSupervisionAuxiliary tHighwayConstructionSupervisionAuxiliary)
    {
        startPage();
        List<THighwayConstructionSupervisionAuxiliary> list = tHighwayConstructionSupervisionAuxiliaryService.selectTHighwayConstructionSupervisionAuxiliaryList(tHighwayConstructionSupervisionAuxiliary);
        return getDataTable(list);
    }

    /**
     * 导出公路建设监督系统辅助信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:auxiliary:export')")
    @Log(title = "公路建设监督系统辅助信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, THighwayConstructionSupervisionAuxiliary tHighwayConstructionSupervisionAuxiliary)
    {
        List<THighwayConstructionSupervisionAuxiliary> list = tHighwayConstructionSupervisionAuxiliaryService.selectTHighwayConstructionSupervisionAuxiliaryList(tHighwayConstructionSupervisionAuxiliary);
        ExcelUtil<THighwayConstructionSupervisionAuxiliary> util = new ExcelUtil<THighwayConstructionSupervisionAuxiliary>(THighwayConstructionSupervisionAuxiliary.class);
        util.exportExcel(response, list, "公路建设监督系统辅助信息数据");
    }

    /**
     * 获取公路建设监督系统辅助信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:auxiliary:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tHighwayConstructionSupervisionAuxiliaryService.selectTHighwayConstructionSupervisionAuxiliaryById(id));
    }

        /**
     * 获取附件信息
     */

    @PreAuthorize("@ss.hasPermi('system:info:query')")
    @GetMapping(value = "/attachment/{highwayConstructionSupervisionId}")
    public TableDataInfo getAttachment(@PathVariable Long highwayConstructionSupervisionId) {
        List<THighwayConstructionSupervisionAuxiliaryAttach> list = tHighwayConstructionSupervisionAuxiliaryService.selectAttachmentById(highwayConstructionSupervisionId);
        return getDataTable(list);
    }

    /**
     * 新增公路建设监督系统辅助信息
     */
    @PreAuthorize("@ss.hasPermi('system:auxiliary:add')")
    @Log(title = "公路建设监督系统辅助信息", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @Transactional
    public AjaxResult add(@RequestBody THighwayConstructionSupervisionAuxiliary tHighwayConstructionSupervisionAuxiliary)
    {
        tHighwayConstructionSupervisionAuxiliaryService.insertTHighwayConstructionSupervisionAuxiliary(tHighwayConstructionSupervisionAuxiliary);
        return toAjax(1);
    }

    /**
     * 修改公路建设监督系统辅助信息
     */
    @PreAuthorize("@ss.hasPermi('system:auxiliary:edit')")
    @Log(title = "公路建设监督系统辅助信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody THighwayConstructionSupervisionAuxiliary tHighwayConstructionSupervisionAuxiliary)
    {
        return toAjax(tHighwayConstructionSupervisionAuxiliaryService.updateTHighwayConstructionSupervisionAuxiliary(tHighwayConstructionSupervisionAuxiliary));
    }

    /**
     * 删除公路建设监督系统辅助信息
     */
    @PreAuthorize("@ss.hasPermi('system:auxiliary:remove')")
    @Log(title = "公路建设监督系统辅助信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tHighwayConstructionSupervisionAuxiliaryService.deleteTHighwayConstructionSupervisionAuxiliaryByIds(ids));
    }

}
